import nacos
import json

SERVER_ADDRESSES = "192.168.178.120:8848"
NAMESPACE = "53736c83-095d-4448-8525-3a8109f03aed"

client = nacos.NacosClient(SERVER_ADDRESSES, namespace=NAMESPACE, username="nacos", password="nacos")

data_id = "user.pro"

group = "pro"

# json_data = json.loads(client.get_config(data_id, group))
# print(client.get_config(data_id,group))
json_data = json.loads(client.get_config(data_id,group))
print(json_data)
print(json_data["name"])
def test_cb(args):
    print("配置文件发生变化")
    print(args)

if __name__ == '__main__':
    client.add_config_watcher(data_id,group,test_cb)
    import time
    time.sleep(300)
